package com.itheima.kebian;

public class ArgsDemo2 {
    public static void main(String[] args) {
        int sum = getSum(1, 2, 3);
        System.out.println(sum);
    }

    //使用可变参数
    //注意：如果有多个参数  记得把可变参数写在在后边
    public static int getSum(int... args) {
        int sum = 0;
        for (int i : args) {
            sum = sum + i;
        }
        return sum;
    }
}
